

#if !defined(_KERNEL) && !defined(_STANDALONE)
#include <stdbool.h>
#endif
#include <sys/atomic.h>

bool bool_compare_and_swap_4(volatile uint32_t *, uint32_t, uint32_t, ...)
    asm("__sync_bool_compare_and_swap_4");

bool
bool_compare_and_swap_4(volatile uint32_t *addr, uint32_t oldval,
	uint32_t newval, ...)
{
	return atomic_cas_32(addr, oldval, newval) == oldval;
}
